package com.info.zhiduoduo.repository.mapper.pay;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.info.zhiduoduo.repository.entity.pay.Payment;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author tianyonghong
 */
public interface PaymentMapper extends BaseMapper<Payment> {

    // 查询支付方式
    @Select("select p.* " +
            " from zdd_payment p" +
            " where if(ISNULL(#{hidden}), 1 = 1, p.hidden = #{hidden} ) " +
            " AND if(ISNULL(#{payTypeSn} or #{payTypeSn} = ''), 1 = 1, p.pay_type_sn = #{payTypeSn} )" +
            " AND if(ISNULL(#{sourceTable}), 1 = 1, p.source_table = #{sourceTable} )" +
            " AND if(ISNULL(#{payName} or #{payName} = ''), 1 = 1, p.pay_name like '%${payName}%' )"
    )
    List<Payment> getPayments(Integer hidden,String payTypeSn,Integer sourceTable,String payName);

}
